package cloud.seckill.seckillserver.common.init;

import cloud.seckill.seckillserver.common.constant.SystemConstant;
import cloud.seckill.seckillserver.common.redis.RedisUtil;
import cloud.seckill.seckillserver.service.RedisService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @title: InitSeckill
 * @Author Wangsj
 * @Date: 2021/5/24
 */
@Slf4j
@Component
public class InitSeckill implements ApplicationRunner {

    @Value("${spring.application.name}")
    public String serviceName;

    @Value("${server.port}")
    public String port;

    @Override
    public void run(ApplicationArguments args) {
        SystemConstant.SERVICE_NAME = serviceName;
        SystemConstant.PORT = port;
        log.info("service:【 {} 】start success!! at port : 【 {} 】", serviceName, port);
    }
}
